<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="author" content="zhaozhenguo">
	<title>选择卡号段</title>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript"><!--
	var org = Common.cOrg();					//当前单位	
	var qt = {};								//数据表格对象		
	var cardStatus = getPara("cardStatus");			
	function load(){
		var sqlName = "sel_cardscope_query"
		var obj = {};
		var billType = getPara("billType")
		var subType = getPara("subType")
		var originStoreStatus = getPara("originStoreStatus")
		if(billType == Constants.CARD_BILL_TYPE_IN){
			obj.storeStatus = CardStoreStatus.MANUFACTURE
		}else if(billType == Constants.CARD_BILL_TYPE_OUT){
			obj.storeStatus = CardStoreStatus.STORE 	
			if(org.orgLevel == Constants.ORG_LEVEL_HQ && subType == CardBillSubType.OUT_INTERNAL){
				if(Project.isOrgRestricted){
					searchForm.targetOrg.value = getPara("targetOrg");
					obj.targetOrgName = getPara("targetOrgName")
					$("targetOrgNameTd").style.display = ''
				}
				
			
			}
		}else if(billType == Constants.CARD_BILL_TYPE_ADJUST){
			if(subType == CardBillSubType.ADJUST_STOCK){
				obj.storeStatus = originStoreStatus;
			}else{
				obj.storeStatus = CardStoreStatus.ONPASSAGE;
				obj.cardOutId = getPara("adjustedId")
				sqlName = "card_bill_scope";
				$("adjustOutPackId").value = getPara("adjustOutPackId");
				$("cardOutTd").style.display = ''
			}
		}else{
			return;	 	
		}
		obj.cardType = getPara("cardTypeName");
		obj.cardStatus = cardStatus;
		searchForm.storeStatus.value = obj.storeStatus;
		searchForm.cardTypeId.value = getPara("cardTypeId");
		searchForm.cardStatus.value = obj.cardStatus;
	    searchForm.location.value = org.id;
	  
		obj.cardStatus = Common.getText("card_status",obj.cardStatus)
		obj.storeStatus = Common.getText("cardstore_status",obj.storeStatus)
		Common.showDetail("searchForm",obj);
		Eui.showNavigation();
		createTable(sqlName);
	}
	
	function createTable(sqlName){
	  	var columns = [];
			columns[0]= {type:"radio"};	
			columns[1]= {defOrder:"asc"};
		qt = new QueryTable(sqlName,"searchForm","datalist",columns);
		qt.showTable();
	}
	function onSave() {
		var obj = qt.getRadioValue(true);
		if(obj==null){
			showWarning("请选择一条数据");return;
		}
		dialogBackValue(obj);
	}

	</script>
</head>
	
<body onload="load()">
	<div id="lookview" >
		<div class="form">
			<form id="searchForm" name="searchForm">
				<input type="hidden" name="location">
				<input type="hidden" name="cardTypeId">
				<input type="hidden" name="cardStatus">
				<input type="hidden" name="storeStatus">
				<input type="hidden" name="targetOrg">
				<input type="hidden" name="adjustOutPackId">
				<table cellSpacing=0 cellPadding=6 width="100%" border=0 class="viewTable">
					<tr>
						<td><label>卡片类型</label> <span id="cardType"></span></td>
						<td><label>卡片状态</label> <span id="cardStatus"></span></td>
						<td><label>库存状态</label> <span id="storeStatus"></span></td>
						<td id="targetOrgNameTd" style="display:none;"><label>使用区域</label> <span id="targetOrgName"> </td>
						<td id="cardOutTd" style="display:none;"><label>出库单编号</label> <span id="cardOutId"> </td>
					</tr>
				</table>
			</form>
		</div>
		<div id="datalist"></div>
	</div>
</body>
</html>